#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2024/12/30 23:14
# @Author : George
import asyncio
import time

start = time.time()


async def request(url):
    print("开始下载", url)
    await asyncio.sleep(2)
    print("下载完毕", url)


url = [
    "http://httpbin.org",
    "http://httpbin2.org",
    "http://httpbin3.org"
]
coroutine_list = [
    request(i) for i in url
]
print(coroutine_list)
asyncio.run(asyncio.wait(coroutine_list))

end = time.time()
print("耗时:", end - start)  # 耗时: 6.021919012069702,耗时: 2.013542890548706
